$OpenBSD: patch-cbits_bitfn_h,v 1.3 2011/04/12 10:43:04 jasper Exp $

- Don't redefine swap32/swap64.

--- cbits/bitfn.h.orig	Tue Apr 12 12:34:26 2011
+++ cbits/bitfn.h	Tue Apr 12 12:36:53 2011
@@ -30,14 +30,17 @@
 /**********************************************************/
 # if (defined(__i386__))
 #  define ARCH_HAS_SWAP32
+#  ifndef swap32
 static inline uint32_t bitfn_swap32(uint32_t a)
 {
 	asm ("bswap %0" : "=r" (a) : "0" (a));
 	return a;
 }
+#  endif
 /**********************************************************/
 # elif (defined(__arm__))
 #  define ARCH_HAS_SWAP32
+#  ifndef swap32
 static inline uint32_t bitfn_swap32(uint32_t a)
 {
 	uint32_t tmp = a;
@@ -48,22 +51,28 @@ static inline uint32_t bitfn_swap32(uint32_t a)
 	             : "=r" (a), "=r" (tmp) : "0" (a), "1" (tmp));
 	return a;
 }
+#  endif
 /**********************************************************/
 # elif defined(__x86_64__)
 #  define ARCH_HAS_SWAP32
 #  define ARCH_HAS_SWAP64
+#  ifndef swap32
 static inline uint32_t bitfn_swap32(uint32_t a)
 {
 	asm ("bswap %0" : "=r" (a) : "0" (a));
 	return a;
 }
 
+#  endif
+#  ifndef swap64
+
 static inline uint64_t bitfn_swap64(uint64_t a)
 {
 	asm ("bswap %0" : "=r" (a) : "0" (a));
 	return a;
 }
 
+#  endif
 # endif
 #endif /* NO_INLINE_ASM */
 /**********************************************************/
@@ -111,12 +120,14 @@ static inline void array_swap32(uint32_t *d, uint32_t 
 }
 #endif
 
+#ifndef swap64
 #ifndef ARCH_HAS_SWAP64
 static inline uint64_t bitfn_swap64(uint64_t a)
 {
 	return ((uint64_t) bitfn_swap32((uint32_t) (a >> 32))) |
 	       (((uint64_t) bitfn_swap32((uint32_t) a)) << 32);
 }
+#endif
 #endif
 
 #ifndef ARCH_HAS_ARRAY_SWAP64
